package com.zjgsu.coursecalendar.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Timestamp;

@Entity
public class Homework {
    private int homeworkId;
    private Integer courseId;
    private String homeworkContent;
    private Integer weekId;
    private Timestamp createTime;
    private Timestamp finishTime;

    @Id
    @Column(name = "homework_id")
    public int getHomeworkId() {
        return homeworkId;
    }

    public void setHomeworkId(int homeworkId) {
        this.homeworkId = homeworkId;
    }

    @Basic
    @Column(name = "course_id")
    public Integer getCourseId() {
        return courseId;
    }

    public void setCourseId(Integer courseId) {
        this.courseId = courseId;
    }

    @Basic
    @Column(name = "homework_content")
    public String getHomeworkContent() {
        return homeworkContent;
    }

    public void setHomeworkContent(String homeworkContent) {
        this.homeworkContent = homeworkContent;
    }

    @Basic
    @Column(name = "week_id")
    public Integer getWeekId() {
        return weekId;
    }

    public void setWeekId(Integer weekId) {
        this.weekId = weekId;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "finish_time")
    public Timestamp getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(Timestamp finishTime) {
        this.finishTime = finishTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Homework homework = (Homework) o;

        if (homeworkId != homework.homeworkId) return false;
        if (courseId != null ? !courseId.equals(homework.courseId) : homework.courseId != null) return false;
        if (homeworkContent != null ? !homeworkContent.equals(homework.homeworkContent) : homework.homeworkContent != null)
            return false;
        if (weekId != null ? !weekId.equals(homework.weekId) : homework.weekId != null) return false;
        if (createTime != null ? !createTime.equals(homework.createTime) : homework.createTime != null) return false;
        if (finishTime != null ? !finishTime.equals(homework.finishTime) : homework.finishTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = homeworkId;
        result = 31 * result + (courseId != null ? courseId.hashCode() : 0);
        result = 31 * result + (homeworkContent != null ? homeworkContent.hashCode() : 0);
        result = 31 * result + (weekId != null ? weekId.hashCode() : 0);
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (finishTime != null ? finishTime.hashCode() : 0);
        return result;
    }
}
